/*
 * @作者: 沙昊
 * @邮箱: shahao@zju.edu.cn
 * @功能: 
 * @包含算法: 
 * Copyright (c) 2023 by 沙昊, All Rights Reserved. 
 */
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

struct TreeNode {
     int val;
     TreeNode *left;
     TreeNode *right;
     TreeNode() : val(0), left(nullptr), right(nullptr) {}
     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 };



void test(TreeNode* root,vector<int>& result) {
    // vector<int> result;
    queue<TreeNode*> my_queue;
    my_queue.push(root);
    while(!my_queue.empty()){
        TreeNode* temp = my_queue.front();
        my_queue.pop();
        if(temp->left){
            my_queue.push(temp->left);
        }
        if(temp->right){
            my_queue.push(temp->right);
        }
        result.push_back(temp->val);
    }

}